package com.soap.learning.server;

import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.Random;
/**
 * Created by k2data on 17-1-9.
 */

@WebService(endpointInterface = "com.soap.learning.server.RandService2")
public class RandImpl implements RandService2 {
    private static final int maxRands = 16;
    @WebMethod
    public int next1(){return new Random().nextInt();}

    @WebMethod
    public int[] nextN(final int n){
        final int k = (n > maxRands)? maxRands: Math.abs(n);
        int [] rand = new int [k];
        Random r = new Random();
        for (int i=0;i<k;i++){
            rand[i] = r.nextInt();
        }
        return rand;
    }

}
